package reflection.equals.assignablefrom;

import org.junit.Assert;
import org.junit.Test;

public class EqualsTest {

	@Test
	public void testVipClient() {
		VipClient vipClient = new VipClient(1L);
		Assert.assertTrue(vipClient.equals(vipClient));
	}

	@Test
	public void test2EqualCars() {
		Long id = 1L;
		VipClient vipClient01 = new VipClient(id);
		VipClient vipClient02 = new VipClient(id);

		Assert.assertTrue(vipClient01.equals(vipClient02));
	}

	@Test
	public void test2DiffCars() {
		Long id01 = 1L;
		Long id02 = 1L;
		VipClient vipClient01 = new VipClient(id01);
		VipClient vipClient02 = new VipClient(id02);

		Assert.assertTrue(vipClient01.equals(vipClient02));
	}

	@Test
	public void test2DiffObj() {
		Long id = 1L;
		VipClient vipClient = new VipClient(id);
		OldClient oldClient = new OldClient(id);
		Client client = new Client(id);

		Assert.assertFalse(vipClient.equals(oldClient));
		Assert.assertFalse(vipClient.equals(client));
	}

	@Test
	public void testParentAndChildObj() {

		Long id = 1L;
		VipClient vipClient = new VipClient(id);
		OldClient oldClient = new OldClient(id);
		Client client = new Client(id);

		Assert.assertFalse(client.equals(oldClient));
		Assert.assertFalse(client.equals(vipClient));

	}

}
